import { IPSSysDBValueFunc } from './ipssys-dbvalue-func';
import { IPSSysSFPlugin } from '../res/ipssys-sfplugin';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSysDBValueFuncImpl extends PSModelObjectImpl implements IPSSysDBValueFunc {
  get codeName(): string {
    return this.M.codeName;
  }

  get dBValueFuncType(): 'PS' | 'UX' {
    return this.M.dBValueFuncType;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get inputStdDataType(): 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 {
    return this.M.inputStdDataType;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  get outputStdDataType(): 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 {
    return this.M.outputStdDataType;
  }

  get outputValueFormat(): string {
    return this.M.outputValueFormat;
  }

  protected pssyssfplugin: IPSSysSFPlugin | null = null;

  getPSSysSFPlugin(): IPSSysSFPlugin | null {
    if (this.pssyssfplugin != null) return this.pssyssfplugin;
    const value = this.M.getPSSysSFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyssfplugin = this.getPSModel4('res.IPSSysSFPlugin', value, 'getPSSysSFPlugin') as IPSSysSFPlugin;
    return this.pssyssfplugin;
  }

  get psSysSFPlugin(): IPSSysSFPlugin | null {
    return this.getPSSysSFPlugin();
  }

  getPSSysSFPluginMust(): IPSSysSFPlugin {
    const value = this.getPSSysSFPlugin();
    if (value == null) {
      throw new Error('未指定后端模板插件对象');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get valueFuncTag(): string {
    return this.M.valueFuncTag;
  }

  get valueFuncTag2(): string {
    return this.M.valueFuncTag2;
  }

  get cls(): string {
    return 'PSSysDBValueFuncImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'database.IPSSysDBValueFunc') return true;
    return super.instanceof(cls);
  }
}
